//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core;

namespace OpenLS.Spreadsheet
{
    class RangeUndoUnit: CompositeUndoUnit
    {
        public RangeUndoUnit(Range range, CellProperty property) : base(property.ToString())
        {
            _range = range;
            _property = property;
        }
        internal override ICompositeUndoUnit GetEmptyClone()
        {
            return new RangeUndoUnit(_range, _property);
        }

        private readonly Range _range;
        private readonly CellProperty _property;
        protected override void DoSelf()
        {
            base.DoSelf();
            _range.Worksheet.Selection.NotifyPropertyChanged(_property);
        }
    }
}
